
from typing import Union
import httpx
from httpx import Response

class HttpRequest:

    def __init__(self):
        pass

    def request(self, method: str, url: str, header: dict, param_type: str = None, params: Union[dict, list] = None,
                file_list: list = None) -> Response:
        if param_type == "from":
            resp = httpx.request(method, url, headers=header, data=params, files=file_list)
        elif param_type == "json":
            resp = httpx.request(method, url, headers=header, json=params, files=file_list)
        else:
            resp = httpx.request(method, url, headers=header)

        return resp

















